| Total Complexity | 1 | 
| Total Lines | 26 | 
| Duplicated Lines | 0 % | 
| Changes | 0 | ||
| 1 | // Class imports  | 
            ||
| 4 | |||
| 5 | /**  | 
            ||
| 6 | * Class responsible for fetching the remote data  | 
            ||
| 7 | */  | 
            ||
| 8 | const fetchRemoteData = async () => { | 
            ||
| 9 | const bilInformasjon = (<HTMLInputElement>(  | 
            ||
| 10 |     document.getElementById("bilinformasjon") | 
            ||
| 11 | )).value;  | 
            ||
| 12 | const API_URL = "/api/getRegNummer?regNummer=";  | 
            ||
| 13 |   const regNummer = `${API_URL}${bilInformasjon}`; | 
            ||
| 14 | |||
| 15 |   try { | 
            ||
| 16 | const response = await fetch(regNummer);  | 
            ||
| 17 | const bilResponse = await response.text();  | 
            ||
| 18 | return JSON.parse(bilResponse);  | 
            ||
| 19 |   } catch (error) { | 
            ||
| 20 | classShowHideElements.hideElements();  | 
            ||
| 21 | classErrorHandler.showErrorFetchingRegNr();  | 
            ||
| 22 | }  | 
            ||
| 23 | };  | 
            ||
| 24 | |||
| 25 | export default { fetchRemoteData }; | 
            ||
| 26 |